//
//  MyTableViewCell.m
//  eshow
//
//  Created by Hisoka on 15/11/16.
//  Copyright © 2015年 Hisoka. All rights reserved.
//

#import "MyTableViewCell.h"

@implementation MyTableViewCell

- (id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        self.iconImg = [UIImageView newAutoLayoutView];
        [self.contentView addSubview:_iconImg];
        
        [_iconImg autoAlignAxis:ALAxisHorizontal toSameAxisOfView:self.contentView];
        [_iconImg autoPinEdge:ALEdgeLeft toEdge:ALEdgeLeft ofView:self.contentView withOffset:10];
        [_iconImg autoSetDimensionsToSize:CGSizeMake(21, 21)];
        
        self.titleLB = [UILabel newAutoLayoutView];
        [self.contentView addSubview:_titleLB];
        
        [_titleLB autoAlignAxis:ALAxisHorizontal toSameAxisOfView:self.contentView];
        [_titleLB autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:_iconImg withOffset:10];
        [_titleLB autoSetDimensionsToSize:CGSizeMake(100, 30)];
        _titleLB.textAlignment = NSTextAlignmentLeft;
        
        self.badgeLB = [UILabel newAutoLayoutView];
        [self.contentView addSubview:_badgeLB];
        
        [_badgeLB autoAlignAxis:ALAxisHorizontal toSameAxisOfView:self.contentView];
        [_badgeLB autoPinEdge:ALEdgeRight toEdge:ALEdgeRight ofView:self.contentView withOffset:0];
        [_badgeLB autoSetDimensionsToSize:CGSizeMake(50, 30)];
        _badgeLB.textAlignment = NSTextAlignmentRight;
        _badgeLB.textColor = GRAY_COLOR;
        _badgeLB.hidden = YES;
        
        self.msgBadgeLB = [UILabel newAutoLayoutView];
        [self.contentView addSubview:_msgBadgeLB];
        
        [_msgBadgeLB autoAlignAxis:ALAxisHorizontal toSameAxisOfView:self.contentView];
        [_msgBadgeLB autoPinEdge:ALEdgeRight toEdge:ALEdgeRight ofView:self.contentView withOffset:0];
        [_msgBadgeLB autoSetDimensionsToSize:CGSizeMake(22, 22)];
        _msgBadgeLB.textAlignment = NSTextAlignmentCenter;
        _msgBadgeLB.textColor = WHITE_COLOR;
        _msgBadgeLB.backgroundColor = [UIColor redColor];
        _msgBadgeLB.layer.masksToBounds = YES;
        _msgBadgeLB.layer.cornerRadius = 11.0f;
        _msgBadgeLB.hidden = YES;
        
    }
    
    return self;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
